<template>
  <el-table
    :data="tableData"
    style="width: 100%">
    <el-table-column
      prop="userId"
      label="操作人"
      width="150">
    </el-table-column>
    <el-table-column
      prop="category"
      label="操作类别"
      width="120">
    </el-table-column>
    <el-table-column
      prop="operatingTime"
      label="操作时间"
      width="180">
    </el-table-column>
    <el-table-column
      prop="remark"
      label="备注">
      <!-- 分行显示 -->
      <template slot-scope="scope">
        <div v-for="(item,index) in scope.row.remark" :key="index">{{item}}</div>
      </template>
    </el-table-column>
  </el-table>
</template>

<script>
  import { getBugOperateHistory } from '@/api/bug'
  import { formatTime } from '@/utils/validate'

  export default {
    name: 'historyTable',
    props:{
      bugId:{
        type: String,
        require: true
      }
    },
    data(){
      return{
        tableData: []
      }
    },
    mounted(){
      getBugOperateHistory(this.bugId).then(res =>{
        for (let i = 0; i < res.data.length; i++){
          res.data[i].operatingTime = formatTime(res.data[i].operatingTime)
          res.data[i].remark = res.data[i].remark.split("/")               //对
        }
        this.tableData = res.data
      })
    }
  }
</script>

<style scoped>

</style>
